package org.skyfree.ghyll.tcard.input;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
import org.skyfree.ghyll.tcard.core.IStoragePath;
import org.skyfree.ghyll.tcard.core.ITCard;

public class TCardInput  implements IEditorInput 
{
	ITCard card;
	public TCardInput(ITCard card)
	{
		this.card = card;
	}
	public boolean exists() 
	{
		return true;
	}

	public ImageDescriptor getImageDescriptor() {
		// TODO Auto-generated method stub
		return null;
	}

	public String getName() {
		return this.card.getItemName();
	}

	public IPersistableElement getPersistable() {
		// TODO Auto-generated method stub
		return null;
	}

	public String getToolTipText() 
	{
		// TODO Auto-generated method stub
		return this.card.getItemName();
	}

	@SuppressWarnings("unchecked")
	public Object getAdapter(Class adapter) 
	{
		if (adapter == ITCard.class) {
			return this.card;			
		}
		else if(adapter == IStoragePath.class) {
			return this.card.getPath();			
		}
		return null;
	}

}
